<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>景点管理列表</title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="format-detection" content="telephone=no"/>
    <link rel="stylesheet" href="/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="/css/font_eolqem241z66flxr.css" media="all"/>
    <link rel="stylesheet" href="/css/news.css" media="all"/>
</head>
<body class="childrenBody">
<form class="layui-form" id="pageForm" name="pageForm" action="/scenicSpot_list" method="post">
    <blockquote class="layui-elem-quote news_search">
        <div class="layui-inline">
            <div class="layui-input-inline">
                <input type="text" name="name" th:value="${name}" placeholder="请输入景点名称"
                       class="layui-input search_input"/>
            </div>
            <button class="layui-btn search_btn" type="submit">查询</button>
        </div>
        <div class="layui-inline">
            <a class="layui-btn layui-btn-normal" th:href="|/scenicSpot_toAdd|">添加景点信息</a>
        </div>
    </blockquote>
    <div class="layui-form news_list">
        <table class="layui-table">
            <colgroup>
                <col width="5%"/>
                <col width="13%"/>
                <col width="8%"/>
                <col width="8%"/>
                <col width="7%"/>
                <col width="7%"/>
                <col width="7%"/>
                <col width="15%"/>

            </colgroup>
            <thead>
            <tr>
                <th>序号</th>
                <th>景点名称</th>
                <th>景点图片</th>
                <th>等级</th>
                <th>成人价格</th>
                <th>老人/学生价格</th>
                <th>儿童价格</th>
                <th>景点地址</th>
<!--                <th>开放时间</th>-->
                <th>状态</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody class="news_content">
            <tr th:each="var,iterStat: ${pagerHelper.records}">
                <td th:text="${iterStat.count}"></td>
                <td th:text="${var.spotName}"></td>
                <td><img th:src="${var.imgUrl.split(' ')[0]}" width="60px" height="60px"></td>
                <td th:if="${var.spotStar==1}">A</td>
                <td th:if="${var.spotStar==2}">AA</td>
                <td th:if="${var.spotStar==3}">AAA</td>
                <td th:if="${var.spotStar==4}">AAAA</td>
                <td th:if="${var.spotStar==5}">AAAAA</td>
                <td th:if="${var.state==''}"></td>
<!--                <td th:text="${var.ticketsMessage}"></td>-->
                <td th:text="${var.adultFee}"></td>
                <td th:text="${var.oldStuFee}"></td>
                <td th:text="${var.childrenFee}"></td>
                <td th:text="${var.spotAddress}"></td>
<!--                <td th:text="${var.openTime}"></td>-->
                <td th:if="${var.state==0}">待发布</td>
                <td th:if="${var.state==1}">已发布</td>
                <td th:if="${var.state==2}">已撤销</td>
<!--                <td th:if="${var.state==''}"></td>-->

                <td>
                    <div class="layui-btn-group">
                    <a class="layui-btn layui-btn-xs" th:href="|/scenicSpot_View/${var.id}|" style="background:#4CAF50;border-radius: 20%">
<!--                        <i class="layui-icon">&#xe60a;</i>-->
                        查看
                    </a>
                    <a class="layui-btn layui-btn-xs layui-btn-normal" th:href="|/scenicSpot_toupdate/${var.id}|">
<!--                        <i class="layui-icon">&#xe642;</i>-->
                        编辑
                    </a>
                    <a class="layui-btn layui-btn-xs layui-btn-danger"
                       th:href="|javascript:scenicSpot_delete('${var.id}');|">
<!--                        <i class="layui-icon">&#xe640;</i>-->
                        删除
                    </a>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <div class="layui-table-page">
        <div id="layui-table-page1">
            <div class="layui-box layui-laypage layui-laypage-default" id="layui-laypage-2">
                <span class="layui-laypage-count" th:text="'共'+${pagerHelper.totalCount}+'条'"></span>
                <span class="layui-laypage-skip">
						<input type="number" name="pageNumber" id="pageNumber" th:value="${pagerHelper.pageNumber}"
                               class="layui-input"/></span>
                <span class="layui-laypage-limits">
						<a class="layui-btn toPage">跳转</a>
						<a class="layui-btn toPageOne">首页</a>
						<a class="layui-btn previousPage"><i class="layui-icon"></i></a>
						<a class="layui-btn nextPage"><i class="layui-icon"></i></a>
						<a class="layui-btn toPageLast">尾页</a>
					</span>
                <span class="layui-laypage-count" th:text="'共'+${pagerHelper.pageCount}+'页'"></span>
                <span class="layui-laypage-limits">
						<select lay-ignore="" id="pageSize" name="pageSize">
							<option value="7" th:selected="${pagerHelper.pageSize==7?'selected':'false'}">7 条/页</option>
							<option value="20"
                                    th:selected="${pagerHelper.pageSize==20?'selected':'false'}">20 条/页</option>
							<option value="30"
                                    th:selected="${pagerHelper.pageSize==30?'selected':'false'}">30 条/页</option>
							<option value="40"
                                    th:selected="${pagerHelper.pageSize==40?'selected':'false'}">40 条/页</option>
							<option value="50"
                                    th:selected="${pagerHelper.pageSize==50?'selected':'false'}">50 条/页</option>
							<option value="60"
                                    th:selected="${pagerHelper.pageSize==60?'selected':'false'}">60 条/页</option>
							<option value="70"
                                    th:selected="${pagerHelper.pageSize==70?'selected':'false'}">70 条/页</option>
							<option value="80"
                                    th:selected="${pagerHelper.pageSize==80?'selected':'false'}">80 条/页</option>
							<option value="90"
                                    th:selected="${pagerHelper.pageSize==90?'selected':'false'}">90 条/页</option>
							<option value="100"
                                    th:selected="${pagerHelper.pageSize==100?'selected':'false'}">100 条/页</option>
						</select>
					</span>
            </div>
        </div>
    </div>
    <input type="hidden" id="count" name="count" th:value="${pagerHelper.totalCount}"/>
    <input type="hidden" id="size" name="size" th:value="${pagerHelper.pageCount}"/>
</form>
<script type="text/javascript" src="/layui/layui.js"></script>
<script type="text/javascript" src="/js/scenicSpot/scenicSpotList.js"></script>

<script type="text/javascript" src="/js/jquery-1.7.2.js"></script>
<script type="text/javascript">

    /**
     * 删除景点
     * @param id
     */
    function scenicSpot_delete(id) {
        //询问框
        layer.confirm('确定删除该条数据嘛?', {
            btn: ['确定', '取消'] //按钮
        }, function () {
            $.getJSON("/scenicSpot_delete/" + id, function (result) {
                if (result.code == 200) {
                    layer.msg('删除成功', {
                        time: 2000, //2s后自动关闭
                    }, function () {
                        location.href = "/scenicSpot_list";
                    });
                } else {
                    layer.msg('删除失败', {
                        time: 2000, //2s后自动关闭
                    });
                }
            });
        });
    }

</script>

</body>
</html>